home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / ASSEMBLE / 3812.ZIP / DIS86216.ZIP / OP16.ASM < prev    next >
Assembly Source File  |  1989-04-15  |  9KB  |  470 lines

  1. ;
  2. ;       op16
  3. ;
  4. ;    80x86 instructions
  5. ;
  6. ;       For disassembly in 16 bit mode
  7. ;
  8. code2seg    segment
  9. farroutine    proc    far
  10.         mov    ax,4c00H
  11.         int    21H    ; if this file is executed, just terminate
  12. farroutine    endp    
  13. ;
  14. code2seg    ends
  15. ;
  16. dataseg        segment
  17. alpha        dw    0
  18. nearindirect    dw    beta
  19. farindirect    dd    farroutine
  20. dataseg    ends
  21. ;
  22. codeseg    segment
  23. ;
  24.     assume ds:dataseg
  25.     assume es:nothing
  26.     assume ss:nothing
  27.     assume cs:codeseg
  28. ;
  29. ;    ensure disassembler synchronization
  30. ;
  31.     nop
  32.     nop
  33.     nop
  34.     nop
  35.     nop
  36.     nop
  37.     nop
  38.     nop
  39.     nop
  40. ;
  41. ;    examples of addressing modes
  42. ;
  43. ;                           mod   r/m
  44. ;                            00  VARIES
  45.     db    10h,00000000b          ;  adc   [bx+si],al
  46.     db    10h,00000001b          ;  adc   [bx+di],al
  47.     db    10h,00000010b          ;  adc   ss:[bp+si],al
  48.     db    10h,00000011b          ;  adc   ss:[bp+di],al
  49.     db    10h,00000100b          ;  adc   [si],al
  50.     db    10h,00000101b          ;  adc   [di],al
  51.     db    10h,00000110b,11h,22h  ;  adc   [2211],al
  52.     db    10h,00000111b          ;  adc   [bx],al
  53. ;
  54. ;                           mod   r/m
  55. ;                            00  VARIES
  56.     db    10h,01000000b,11h   ;  adc   [bx+si+11],al
  57.     db    10h,01000001b,11h   ;  adc   [bx+di+11],al
  58.     db    10h,01000010b,11h   ;  adc   ss:[bp+si+11],al
  59.     db    10h,01000011b,11h   ;  adc   ss:[bp+di+11],al
  60.     db    10h,01000100b,11h   ;  adc   [si+11],al
  61.     db    10h,01000101b,11h   ;  adc   [di+11],al
  62.     db    10h,01000110b,11h   ;  adc   ss:[bp+11],al
  63.     db    10h,01000111b,11h   ;  adc   [bx+11],al
  64. ;
  65. ;                           mod   r/m
  66. ;                            00  VARIES
  67.     db    10h,10000000b,11h,22h   ;  adc   [bx+si+2211],al
  68.     db    10h,10000001b,11h,22h   ;  adc   [bx+di+2211],al
  69.     db    10h,10000010b,11h,22h   ;  adc   ss:[bp+si+2211],al
  70.     db    10h,10000011b,11h,22h   ;  adc   ss:[bp+di+2211],al
  71.     db    10h,10000100b,11h,22h   ;  adc   [si+2211],al
  72.     db    10h,10000101b,11h,22h   ;  adc   [di+2211],al
  73.     db    10h,10000110b,11h,22h   ;  adc   ss:[bp+2211],al
  74.     db    10h,10000111b,11h,22h   ;  adc   [bx+2211],al
  75. ;
  76. ;    another 32 examples of addressing modes
  77. ;
  78.     pop    [bx+si]
  79.     pop    [bx+di]
  80.     pop    ss:[bp+si]
  81.     pop    ss:[bp+di]
  82.     pop    [si]
  83.     pop    [di]
  84.     add     ax,[0006]   ; illustrate immediate addressing with add
  85.                             ; instruction, since there's no immediate pop
  86.     pop    [bx]
  87.     pop    [08+bx+si]
  88.     pop    [09+bx+di]
  89.     pop    ss:[0aH+bp+si]
  90.     pop    ss:[0bH+bp+di]
  91.     pop    [0cH+si]
  92.     pop    [0dH+di]
  93.     pop    ss:[0eH+bp]
  94.     pop    [0fH+bx]
  95.     pop    [1010H+bx+si]
  96.     pop    [1011H+bx+di]
  97.     pop    ss:[1012H+bp+si]
  98.     pop    ss:[1013H+bp+di]
  99.     pop    [1014H+si]
  100.     pop    [1015H+di]
  101.     pop    ss:[1016H+bp]
  102.     pop    [1017H+bx]
  103.     pop    ax
  104.     pop    cx
  105.     pop    dx
  106.     pop    bx
  107.     pop    sp
  108.     pop    bp
  109.     pop    si
  110.     pop    di
  111. ;
  112. ;    illustrate segment register usage
  113. ;
  114.     pop    [bx]        ; default is ds:
  115.     pop    cs:[bx]
  116.     pop    ss:[bx]
  117.     pop    ds:[bx]
  118.     pop    es:[bx]
  119.     pop    [bp]        ; default is ss:
  120.     pop    cs:[bp]
  121.     pop    ss:[bp]
  122.     pop    ds:[bp]
  123.     pop    es:[bp]
  124. ;
  125. nearroutine    proc    near
  126. nearroutine    endp
  127. ;
  128. ;    8088 instructions in alphabetical order
  129. ;    (as in Intel's "iAPX 88 Book")
  130. ;
  131.     aaa
  132.     aad
  133.     aam
  134.     aas
  135.     adc    cx,[bx]
  136.     adc    cx,alpha
  137.     adc    cx,13
  138.     adc    ax,13
  139.     add    cx,[bx]
  140.     and    cx,[bx]
  141.     call    nearroutine
  142.     call    farroutine
  143.     call    nearindirect
  144.     call    farindirect
  145.     cbw
  146.     clc
  147.     cld
  148.     cli
  149.     cmc
  150.     cmp    cx,[bx]
  151.     cmpsb
  152.     cmpsw
  153.     cwd
  154.     daa
  155.     das
  156.     dec    ax
  157.     dec    al
  158.     dec    byte ptr [bx]
  159.     div    cx
  160. ;
  161. ;    esc            floating point operations
  162. ;
  163. ;                               (not valid for my assembler)
  164. ;
  165.     db    0d9H,0faH    ;    fsqrt
  166.     db    0d9H,0fdH    ;    fscale
  167.     db    0d9H,0f8H    ;    fprem
  168.     db    0d9H,0fcH    ;    frndint
  169.     db    0d9H,0f4H    ;    fxtract
  170.     db    0d9H,0e1H    ;    fabs
  171.     db    0d9H,0e0H    ;    fchs
  172.     db    0d9H,0f2H    ;    fptan
  173.     db    0d9H,0f3H    ;    fpatan
  174.     db    0d9H,0f0H    ;    f2xm1
  175.     db    0d9H,0f1H    ;    fyl2x
  176.     db    0d9H,0f9H    ;    fyl2xp1
  177.     db    0dbH,0e3H    ;    finit
  178.     db    0dbH,0e0H    ;    feni
  179.     db    0dbH,0e1H    ;    fdisi
  180.     db    0d9H,028H    ;    fldcw          [bx+si]
  181.     db    0d9H,038H    ;    fstcw          [bx+si]
  182.     db    0ddH,038H    ;    fstsw          [bx+si]
  183.     db    0dbH,0e2H    ;    fclex
  184.     db    0d9H,030H    ;    fstenv          [bx+si]
  185.     db    0d9H,020H    ;    fldenv          [bx+si]
  186.     db    0ddH,030H    ;    fsave          [bx+si]
  187.     db    0ddH,020H    ;    frstor          [bx+si]
  188.     db    0d9H,0f7H    ;    fincstp
  189.     db    0d9H,0f6H    ;    fdecstp
  190.     db    0ddH,0c0H    ;    ffree
  191.     db    0d9H,0d0H    ;    fnop
  192.     db    09bH        ;    fwait
  193.     db    0d9H,000H    ;    fld st(0),dword [bx+si]
  194.     db    0dfH,028H    ;    fld st(0),LONG INT [bx+si]
  195.     db    0dbH,028H    ;    fld st(0),temp real [bx+si]
  196.     db    0d9H,0c0H    ;    fld st(0),st(i)
  197.     db    0d9H,010H    ;    fst int,st(0) [bx+si]
  198.     db    0ddH,0d0H    ;    fst st(i),st(0) [bx+si]
  199.     db    0d9H,018H    ;    fstp st(0) int/real
  200.     db    0dfH,038H    ;    fstp st(0) long int
  201.     db    0d8H,0d8H    ;    fcomp st(i)
  202.     db    0deH,0d9H    ;    fcompp
  203.     db    0d9H,0e4H    ;    ftst
  204.     db    0d9H,0e5H    ;    fxam
  205.     db    0d9H,0e8H    ;    fld1
  206.     db    0d9H,0eeH    ;    fldz
  207.     db    0d9H,0e4H    ;    ftst
  208.     db    0d9H,0eaH    ;    fldl2e
  209.     db    0d9H,0ebH    ;    fldpi
  210.     db    0d9H,0ecH    ;    fldlg2
  211.     db    0d9H,0edH    ;    fldln2
  212. ;
  213.     hlt
  214.     idiv    dx
  215.     imul    bx
  216.     in    ax,67
  217.     in    ax,dx
  218.     inc    dl
  219.     inc    dx
  220.     int    3
  221.     int    33
  222.     into
  223.     iret
  224.     ja    $+33
  225.     jnbe    $+33
  226.     jae    $+34
  227.     jnb    $+34
  228.     jb    $+35
  229.     jnae    $+35
  230.     jbe    $+36
  231.     jna    $+36
  232.     jc    $+37
  233.     jcxz    $+38
  234.     je    $+39
  235.     jz    $+39
  236.     jg    $+40
  237.     jnle    $+40
  238.     jge    $+41
  239.     jnl    $+41
  240.     jl    $+42
  241.     jnge    $+42
  242.     jle    $+43
  243.     jng    $+43
  244.     jmp    nearroutine
  245.     jmp    farroutine
  246.     jnc    $+44
  247.     jne    $+45
  248.     jnz    $+45
  249.     jno    $+46
  250.     jns    $+47
  251.     jnp    $+48
  252.     jpo    $+48
  253.     jo    $+49
  254.     jp    $+50
  255.     jpe    $+50
  256.     js    $+51
  257.     lahf
  258.     lds    cx,[bx]
  259.     lea    cx,[bx]
  260.     les    cx,[bx]
  261.     lock    add ax,1
  262.     lodsw
  263.     lodsb
  264.     loop    $+33
  265.     loope    $+34
  266.     loopz    $+34
  267.     loopnz    $+35
  268.     loopne    $+35
  269.     mov    ax,bx
  270.     mov    byte ptr [bx],35
  271.     mov    bx,34
  272.     mov    ax,35
  273.     mov    [bx+345],ax
  274.     mov    alpha,ax
  275.     mov    ax,[345]
  276.     mov    ds,ax
  277.     mov    [bx+346],ds
  278.     movsb
  279.     movsw
  280.     mul    bx
  281.     neg    byte ptr [bx]
  282.     nop
  283.     not    byte ptr [bx]
  284.     or    [bx+34],cx
  285.     or    byte ptr [bx+35],78
  286.     or    ax,67
  287.     out    88,ax
  288.     out    dx,al
  289.     pop    [bx+890]
  290.     pop    ax
  291.     pop    ds
  292.     popf
  293.     push    [bx+879]
  294.     push    bx
  295.     push    ds
  296.     pushf
  297.     rcl    byte ptr [bx],1
  298.     rcr    byte ptr [bx],cl
  299.     rep    stosb
  300.     repe    stosb
  301.     repne    stosb
  302. beta    proc    near
  303.     ret
  304.     ret    3
  305. beta    endp
  306. delta    proc    far
  307.     ret
  308.     ret    3
  309. delta    endp
  310.     rol    dx,1
  311.     rol    dx,cl
  312.     ror    dx,1
  313.     ror    byte ptr [bx+3],cl
  314.     sahf
  315.     sal    cx,1
  316.     sal    dx,cl
  317.     sar    dx,1
  318.     sar    dx,cl
  319.     sar    dx,1
  320.     sar    dx,cl
  321.     sbb    dx,cx
  322.     sbb    dx,1
  323.     sbb    al,3
  324.     scasw
  325.     scasb
  326.     shr    ax,1
  327.     shr    ax,cl
  328.     stc
  329.     std
  330.     sti
  331.     stosb
  332.     sub    dx,cx
  333.     sub    dx,3
  334.     sub    ax,3
  335.     test    dx,cx
  336.     wait
  337.     xchg    [bx+45],cx
  338.     xchg    ax,cx
  339.     xlat
  340.     xor    cx,78
  341. ;
  342. ;    80186 & V20 instructions
  343. ;
  344.     db    62h,0        ;bound
  345.     db    0c8h,33,44,5    ;enter procedure
  346.     db    69h,0,33,44    ;imul immediate
  347.     db    69h,0c0h,33,44    ;imul immediate
  348.     db    6bh,0,33    ;imul immediate
  349.     db    6bh,0c0h,33    ;imul immediate
  350.     db    6ch        ;ins dx
  351.     db    0f2h,6ch    ;ins dx repeated by count in cx
  352.     db    0c9h        ;leave procedure
  353.     db    6eh        ;outs dx
  354.     db    0f2h,6eh    ;outs dx repeated by count in cx
  355.     db    61h        ;popa
  356.     db    68h,33h,44h    ;push immediate
  357.     db    6ah,33h        ;push immediate
  358.     db    60h        ;pusha
  359.     db    0c0h,00h,3    ;ROL memory by count
  360.     db    0c0h,08h,3    ;ROR memory by count
  361.     db    0c0h,10h,3    ;RCL memory by count
  362.     db    0c0h,18h,3    ;RCR memory by count
  363.     db    0c0h,20h,3    ;SHL/SAL memory by count
  364.     db    0c0h,28h,3    ;SHR memory by count
  365.     db    0c0h,38h,3    ;SAR memory by count
  366. ;
  367.     db 90H,90H,90H,90H,90H,90H,90H,90H,90H        ; alignment
  368.  
  369. ;
  370. ;            80386 unique prefix bytes
  371. ;
  372.     db    64h        ;fs:
  373.     mov    byte ptr [bx],11h
  374.     db    65h        ;gs:
  375.     mov    byte ptr [bx],11h
  376. ;
  377.     db    66h        ;32 bit operand
  378.     adc    cx,2211h
  379.     dw    4433h
  380. ;
  381.     db    66h        ;32 bit operand
  382.     adc    ax,2211h
  383.     dw    4433h
  384. ;
  385.     db    67h        ;32 bit address
  386.     mov    ax,alpha
  387.     dw    4433h
  388. ;
  389.     db    66h        ;32 bit operand
  390.     db    67h        ;32 bit address
  391.     mov    ax,alpha
  392.     dw    4433h
  393.     nop
  394.     nop
  395.     nop
  396.     nop
  397.     nop
  398.     nop
  399.     nop
  400. ;
  401. ;            80386 unique instructions
  402. ;
  403.     db    0fh,22h,0c0h    ;mov CR0,eax
  404.     db    0fh,22h,0c8h    ;           illegal
  405.     db    0fh,22h,0d0h    ;mov CR2,eax
  406.     db    0fh,22h,0d8h    ;mov CR3,eax
  407.     db    0fh,22h,0e0h    ;           illegal
  408.     db    0fh,22h,0e8h    ;           illegal
  409.     db    0fh,22h,0f0h    ;           illegal
  410.     db    0fh,22h,0f8h    ;           illegal
  411.  
  412.     db    0fh,20h,0c0h    ;mov eax,CR0
  413.     db    0fh,20h,0c8h    ;           illegal
  414.     db    0fh,20h,0d0h    ;mov eax,CR2
  415.     db    0fh,20h,0d8h    ;mov eax,CR3
  416.     db    0fh,20h,0e0h    ;           illegal
  417.     db    0fh,20h,0e8h    ;           illegal
  418.     db    0fh,20h,0f0h    ;           illegal
  419.     db    0fh,20h,0f8h    ;           illegal
  420.  
  421.     db    0fh,23h,0c0h    ;mov DR0,eax
  422.     db    0fh,23h,0c8h    ;mov DR1,eax
  423.     db    0fh,23h,0d0h    ;mov DR2,eax
  424.     db    0fh,23h,0d8h    ;mov DR3,eax
  425.     db    0fh,23h,0e0h    ;           illegal
  426.     db    0fh,23h,0e8h    ;           illegal
  427.     db    0fh,23h,0f0h    ;mov DR6,eax
  428.     db    0fh,23h,0f8h    ;mov DR7,eax
  429.  
  430.     db    0fh,21h,0c0h    ;mov eax,DR0
  431.     db    0fh,21h,0c8h    ;mov eax,DR1
  432.     db    0fh,21h,0d0h    ;mov eax,DR2
  433.     db    0fh,21h,0d8h    ;mov eax,DR3
  434.     db    0fh,21h,0e0h    ;           illegal
  435.     db    0fh,21h,0e8h    ;           illegal
  436.     db    0fh,21h,0f0h    ;mov eax,DR6
  437.     db    0fh,21h,0f8h    ;mov eax,DR7
  438.  
  439.     db    0fh,26h,0c0h    ;           illegal
  440.     db    0fh,26h,0c8h    ;           illegal
  441.     db    0fh,26h,0d0h    ;           illegal
  442.     db    0fh,26h,0d8h    ;           illegal
  443.     db    0fh,26h,0e0h    ;           illegal
  444.     db    0fh,26h,0e8h    ;           illegal
  445.     db    0fh,26h,0f0h    ;mov TR6,eax
  446.     db    0fh,26h,0f8h    ;mov TR7,eax
  447.  
  448.     db    0fh,24h,0c0h    ;           illegal
  449.     db    0fh,24h,0c8h    ;           illegal
  450.     db    0fh,24h,0d0h    ;           illegal
  451.     db    0fh,24h,0d8h    ;           illegal
  452.     db    0fh,24h,0e0h    ;           illegal
  453.     db    0fh,24h,0e8h    ;           illegal
  454.     db    0fh,24h,0f0h    ;mov eax,TR6
  455.     db    0fh,24h,0f8h    ;mov eax,TR7
  456.  
  457.     db    0fh,24h,0f8h    ;mov eax,TR7
  458.     db    0fh,24h,0f9h    ;mov ecx,TR7
  459.     db    0fh,24h,0fah    ;mov edx,TR7
  460.     db    0fh,24h,0fbh    ;mov ebx,TR7
  461.     db    0fh,24h,0fch    ;mov esp,TR7
  462.     db    0fh,24h,0fdh    ;mov ebp,TR7
  463.     db    0fh,24h,0feh    ;mov esi,TR7
  464.     db    0fh,24h,0ffh    ;mov edi,TR7
  465. ;
  466. codeseg    ends
  467. ;
  468.  
  469.     end
  470.